/*******************************************************************************
* CSCI321 Major Project 2010 - University of Wollongong                        *
********************************************************************************
* Program:		WeaveEdit                                              *
* Authors:		Simon Allen (Student#: 3457527, Unix: sa655)           *
*			Scott Bellis (Student#: 3479110, Unix: sjb900)         *
*			Jason Benger (Student#: 3454137, Unix: jb960)          *
*			Timothy Newmarch (Student#: 3459263 Unix: tgn336)      *
*			Benjamin Richardson (Student# 3467752, Unix: bjr401)   *
* Supervisor:		Daniel F. Saffioti                                     *
* Modified:		28/10/2010                                             *
* Description:		WeaveEdit is a highly portable collaborative text      *
*			editor and word processor, allowing several users to   *
*			read and edit multiple documents at the same time.     *
*			It is available for Mac OS X, Windows and Linux,       *
*			utilising Nokia's Qt development framework.            *
*******************************************************************************/


#ifndef FIND_H
#define FIND_H

#include "findoptions.h"

#include "Editor/editor.h"
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>


/**
  * Simple find widget the pops up over a document, allowing users to find/replace text.
  */
class Find : public QWidget
{
	Q_OBJECT

	private:
		QLabel *opLabel;
		QLineEdit *findText;
		QPushButton *prevButton;
		QPushButton *nextButton;
		QLabel *replaceLabel;
		QLineEdit *replaceText;
		QPushButton *replaceButton;
		QPushButton *replaceAllButton;
		FindOptions *findOptions;
		Editor *editor;
		QTextCursor findCursor;

	public:
		Find(Editor *newEditor = NULL);

		void enableReplace();
		void disableReplace();
		void show();

	private slots:
		void find(QString text, int pos = 0, bool backwards = false);
		void findNext();
		void findPrev();
		void replace();
		void replaceAll();
};

#endif // FIND_H
